package com.powervision.mvvmdemo.ui.viewmodel

import com.powervision.base.base.BaseViewModel
import com.powervision.http.observer.StateLiveData
import com.powervision.mvvmdemo.ui.model.ArticleListModel
import com.powervision.mvvmdemo.ui.repository.WxArticleListRepository

/**
 * @auth: njb
 * @date: 2021/12/22 15:31
 * @desc: 描述
 */
class WxArticleListViewModel : BaseViewModel() {
    private val mWxArticleListRepository by lazy { WxArticleListRepository() }
    val mWxArticleListLiveData = StateLiveData<ArticleListModel>()

    fun articleList(page: Int, id: String) {
        launchWithLoading(
            requestBlock = {
                mWxArticleListRepository.wxArticleList(page, id)
            }, resultCallback = {
                mWxArticleListLiveData.value = it
            })
    }
}